package cn.iocoder.yudao.module.demo.dal.mysql.student;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.demo.dal.dataobject.student.StudentClassDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 学生班级 Mapper
 *
 * @author leesea
 */
@Mapper
public interface StudentClassMapper extends BaseMapperX<StudentClassDO> {

    default PageResult<StudentClassDO> selectPage(PageParam reqVO, Long studentId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentClassDO>()
                .eq(StudentClassDO::getStudentId, studentId)
                .orderByDesc(StudentClassDO::getId));
    }

    default StudentClassDO selectByStudentId(Long studentId) {
        return selectOne(StudentClassDO::getStudentId, studentId);
    }

    default int deleteByStudentId(Long studentId) {
        return delete(StudentClassDO::getStudentId, studentId);
    }

}
